class ScreenLayer extends egret.DisplayObjectContainer {

    public constructor() {
        super()
        this.once(egret.Event.ADDED_TO_STAGE, this.init, this)
    }

    private init() {
        const miva = this
        miva.width = miva.stage.stageWidth
        miva.height = miva.stage.stageHeight
        // 加载道具数据
        const dataItem = RES.getRes(`data_item_json`)
        console.log(dataItem)
        ParamsPool.DATA_ITEM = dataItem
        // 加载bgm
        ParamsPool.BGM = RES.getRes('bgm_mp3')

        miva.loadStartAnimation()
    }
    // 加载开场动画
    private loadStartAnimation() {
        const miva = this
        const _screen = new ScreenStartAniamtion()

        miva.addChild(_screen)
        miva.stage.addEventListener('START', _ => {
            miva.loadScreenGame()
            miva.removeChild(_screen)
        }, miva)
    }
    // 加载主场景
    private loadScreenGame() {
        const _screen = new ScreenGame()
        this.addChild(_screen)

        this.stage.addEventListener('FINISH', _ => {
            Utils.shareImage(this)
        }, this)
    }

}